Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mono][jit] Don't truncate the high bits when ldelema index is nint #88986

Merged
merged 5 commits into from
Sep 8, 2023

Conversation

BrzVlad
Copy link
Member

@BrzVlad BrzVlad commented Jul 17, 2023

JIT only fix from #73799. Interp fix might be more invasive.

@BrzVlad
Copy link
Member Author

BrzVlad commented Jul 19, 2023

A little bit of complication because, according to comments, emitting the SEXT_I4 normally would interfere with bounds check removal. @vargaz Please take a look

Previous code was assuming index is i4. Remove MONO_ARCH_EMIT_BOUNDS_CHECK on amd64 since it was doing a I4 comparison, while the index reg is i8. Use MONO_EMIT_DEFAULT_BOUNDS_CHECK instead also on amd64.

On llvm we might not be able to insert the sign extending because it apparently interferes with abcrem optimization. We therefore split OP_BOUNDS_CHECK into two separate opcodes, so, after abcrem, we know whether we have to insert the sext or not.
Fix passing of i4 to wrapper accepting native int. The wrapper no longer does the sign extend in order to not lose high bits of native int.
@BrzVlad
Copy link
Member Author

BrzVlad commented Sep 6, 2023

@vargaz Could I have a review on this ?

@BrzVlad BrzVlad merged commit 840e8fa into dotnet:main Sep 8, 2023
152 of 155 checks passed
@ghost ghost locked as resolved and limited conversation to collaborators Oct 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants